package com.flashflexpro.tanksinbattle.spring;

import flex.messaging.FactoryInstance;
import flex.messaging.FlexContext;
import flex.messaging.FlexFactory;
import flex.messaging.config.ConfigMap;
import org.springframework.web.context.support.WebApplicationContextUtils;

/**
 * @author gyang@brightcove.com
 */
public class SpringFactoryInstance extends FactoryInstance {
    public SpringFactoryInstance(FlexFactory factory, String id, ConfigMap properties) {
        super(factory, id, properties);
    }

    public Object getSpringBean() {
        return WebApplicationContextUtils.getWebApplicationContext(FlexContext.getServletContext()).getBean(getSource());
    }

}
